package cn.caijiapeng.spt.ctrl.admin;

import com.jfinal.core.Controller;

import cn.caijiapeng.spt.bean.Resp;
import cn.caijiapeng.spt.config.WebConst;
import cn.caijiapeng.spt.model.SysAccess;
import cn.caijiapeng.spt.service.SysAccessService;
import cn.caijiapeng.spt.service.SysLoginLogService;

public class AdminCtrl extends Controller{
	public void index() {
		renderJson(Resp.ok());
	}
	
	public void logout() {
		SysAccess sysAccess = getAttr(WebConst.LOGIN_SYS_ACCESS);
		SysAccessService.srv.logout(sysAccess.getStr("token"));
		renderJson(Resp.ok());
	}
	
	public void loginLog() {
		Integer pageNumber = getParaToInt("pageNumber", 1);
		Integer pageSize = getParaToInt("pageSize", 20);
		renderJson(Resp.ok(SysLoginLogService.srv.getPage(pageNumber, pageSize)));
	}
	
}
